package com.config.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.config.common.Result;
import com.config.entity.Sample;
import com.config.service.SampleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 样本统计前端控制器
 * </p>
 *
 * @author Lu
 * @since 2021-02-04
 */
@Api (tags ="样本统计设置页面接口")
@RestController
@RequestMapping ("/config/sample")
public class SampleController {

	@Autowired
	SampleService sampleService;

	@ApiOperation("获取所有信息")
	@GetMapping ("/sampleAll")
	public Result selectAll() {
		QueryWrapper<Sample> queryWrapper=new QueryWrapper<>();
		List<Sample> list = sampleService.list(queryWrapper);
		return Result.succ(list);
	}

	@ApiOperation ("修改列表数据")
	@PutMapping ("/saupd")
	public Result upsaChoose0(@RequestBody Sample sample) {
		boolean update = sampleService.updateById(sample);
		if (update) {
			return Result.succ(sample);
		} else {
			return Result.fail("修改失败");
		}
	}
}

